Feed Aggregator Page 685
Rendered on Tue, 15 Feb 2022 08:01:13 GMT
Rendered on Tue, 15 Feb 2022 08:01:13 GMT
via Planet Lisp by on Mon, 14 Feb 2022 17:37:00 GMT
Most popular computer languages don't have symbols as a data type. You can make do with a string, or encode your symbol as a small integer or enum. It's a hack, but simple enough and common enough that it doesn't need a second thought.
Lisp has symbols, though, so if you are using a string as a stand-in you should give it a second thought. In Lisp, symbols and strings have different roles. Strings are composite objects, symbols are atomic. String operations are concerned with the contents of the string, symbol operations are concerned with the identity of the symbol.
I saw a Common Lisp Tic Tac Toe program that represented the
players' marks with the strings "X"
and "O"
. I could see no reason why it couldn't have
used the symbols 'X
and 'O
. Or
the keywords :X
and :O
. Or how about the
Unicode symbols '✗
and '◯
?
Symbolic processing is the raison d'être of Lisp. It's a little absurd to represent symbols as strings in Lisp.
via Elm - Latest posts by @system system on Mon, 14 Feb 2022 18:34:22 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @kyclark Ken Youens-Clark on Mon, 14 Feb 2022 16:34:52 GMT
Here is my progress: https://ellie-app.com/gGNGVvZZHYva1
I’m trying to figure how to parse JSON like this:
“timeoutPolicy”: {
“main”: {
“hours”: 12
},
“*”: {
“hours”: 4,
“minutes”: 30
}
}
The keys of this hash represent the “entry point” of step or function. E.g.:
timeoutPolicy
(i.e. “main”) will timeout after 4 hours 30 minutes.So far I have figured out how to parse JSON like:
{ “hours”: 3 }
Or
{ “minutes”: 60 }
Into a structure like
{ entryPointName: “*”, timeUnit: “hours”, value: 3 }
I’m struggling with how to parse a dictionary where I capture the primary keys like “main” or “*” as the entryPointName and then capture keys like “hours” or “minutes” to use as the timeUnit and then the values (converted to ints) as the time values.
Ultimately, I want a List TimeoutPolicy like:
[ { entryPointName: “main”, hours: 3, minutes: 0 }, { entryPointName: “*”, hours: 0, minutes: 60 } ]
via Elm - Latest posts by @jfmengels Jeroen Engels on Mon, 14 Feb 2022 15:18:17 GMT
Episode 050: Large Elm Codebases with Ju Liu is out!
@Arkham joins us to share some tips and techniques from working with a large Elm codebase at NoRedInk.
We hope you enjoy the episode!
via Elm - Latest posts by @supermario Mario Rogic on Mon, 14 Feb 2022 12:27:22 GMT
No date set yet, so we could go for March 30
via Elm - Latest posts by @allanderek Allanderek on Mon, 14 Feb 2022 10:01:37 GMT
As you explain there are multiple debouncing packages. So the first thing to do would be to explain why there are multiple packages, and explain why one of them should be moved into the standard library. This would mean explaining why that one single package (perhaps suitably improved) deprecates the need for all the others. On top of that, you would also have to explain what benefit moving it into the standard library has? What is the problem with it just being a package?
Personally I’d think there are too many different strategies and goals for a single debounce package. On top of which moving something into the standard library has a pretty high bar. So I think moving such a debounce package into the standard library is unlikely. But that’s just my opinion.
via Elm - Latest posts by @romper stomper on Mon, 14 Feb 2022 08:17:21 GMT
Any thoughts about this? Maybe @evancz could voice an opinion?
via Elm - Latest posts by @system system on Mon, 14 Feb 2022 08:14:23 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @francescortiz Francesc Ortiz on Mon, 14 Feb 2022 00:01:53 GMT
Thanks! We were just looking for this rule a few days ago.
via Elm - Latest posts by @system system on Sun, 13 Feb 2022 16:22:50 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @system system on Sat, 12 Feb 2022 17:44:14 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @system system on Sat, 12 Feb 2022 08:11:49 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @lucamug on Sat, 12 Feb 2022 01:37:38 GMT
A special edition of the Elm Online Meetup seems a nice idea. Do you already have a date for it?
via Planet Lisp by on Fri, 11 Feb 2022 08:53:16 GMT
Hi, all Common Lispers.
I have introduced Roswell as a script execution environment in the recent 2 blog posts. Though this blog is not only for Roswell, I'm surprised that there's still to be written about Roswell.
I'm going to write today is the easy way to startup a Common Lisp application with Roswell.
-s
option-s
option for ros
command is for loading a library (ASDF system). If it's used with run
subcommand, the system is already loaded in the started REPL:
# Load Dexador and start REPL
$ ros -s dexador run
* (dex:get "https://api.quickdocs.org")
However, the option has a secret feature.
Let's take a look at a real example, http.server:
$ ros install roswell/http.server
$ ros -s http.server
Hunchentoot server is going to start.
Listening on 127.0.0.1:5000.
What's happening here?
The -s
option, which is not followed by any subcommands, Roswell invokes the system's entry point (if it's defined).
The "http.server" entry point starts a static HTTP server for the current directory. http://localhost:5000
serves an index.html if it exists. If not, it shows a list of files/directories.
Note: This idea obviously came from Python's http.server.
The official GitHub repos is here:
ASDF's entry point is used only when building an executable officially; however, Roswell uses it to run a Common Lisp app from command-line instantly.
For instance, if your application named "myapp" has an entry point function, and wants to invoke it, the following command will work.
$ ros -S . -s myapp
-S
(a large S) adds a directory to the ASDF registry path. -S .
is like an idiom to allow ASDF to search systems from the current directory.
This -s
behavior is almost hidden, and I don't know other examples to show you yet. Consider using this when you write a Common Lisp application.
via Elm - Latest posts by @supermario Mario Rogic on Fri, 11 Feb 2022 11:45:54 GMT
That’s really cool! It’s almost when I run the Elm Online Meetup, so I’ll run a special edition for the date.
Maybe we could do a mini hackathon! Ideas welcome.
via Elm - Latest posts by @Warry Maxime on Fri, 11 Feb 2022 10:58:54 GMT
This is hilarious, I never noticed that comment from Evan from the announcement:
via Elm - Latest posts by @Warry Maxime on Fri, 11 Feb 2022 10:21:39 GMT
Hi folks !
On Match 30th it will be Elm’s 10 years anniversary ! I like the opportunity of a celebration, to show our commitment to the project and to spread the word.
It’s way too late for a conference or anything fancy, but we could pick a day (March 30th, it’s a Wednesday) or a weekend (April 1st is a Friday) where volunteers could do Twich lives, hackathons, blog posts or tweets even.
What do you think ?
Cheers o/
PS:
Elm first release announcement: https://www.reddit.com/r/haskell/comments/rkyoa/my_thesis_is_finally_complete_elm_concurrent_frp/
All Elm releases: news
via Elm - Latest posts by @absynce Jared M. Smith on Fri, 11 Feb 2022 04:03:17 GMT
I added a fix to the elm-review NoMissingTypeConstructor rule. I’m looking for folks to try this and provide feedback on how it works for you.
elm-review --template Arkham/elm-review-no-missing-type-constructor/example --fix
Before fix
module Fruit exposing (Fruit, all)
type Fruit
= Apple
| Banana
| Kiwi
| Pineapple
all : List Fruit
all =
[ Banana
, Apple
]
After fix
module Fruit exposing (Fruit, all)
type Fruit
= Apple
| Banana
| Kiwi
| Pineapple
all : List Fruit
all =
[ Banana
, Apple
, Kiwi
, Pineapple
]
The missing type constructors Kiwi
and Pineapple
were added in alphabetical order.
Is this fix acceptable? Do you rely on the order?
When I use an all
value I usually have toString : Fruit -> String
that returns the display name. Then I sort by that:
Fruit.all
|> List.map Fruit.toString
|> List.sort
Using this technique, the order of the variants in all
is irrelevant.
Maybe you have a different concern. Or maybe this fix is just fine. Please let me know your thoughts.
via Elm - Latest posts by @samjk Sam on Thu, 10 Feb 2022 17:47:33 GMT
Yeah for me what helped was realizing that those characters have to be stored somewhere…in React it’s in a component and in Elm it’s in the Model. Was weird for me when I learned React as well!
via Elm - Latest posts by @ines.uslu Inés Uslu on Thu, 10 Feb 2022 17:37:12 GMT
Thanks, @samjk. I did end up using your suggestion earlier. I learned quickly that onBlur
does not get ahold of the input’s text and I’d have to store it somewhere with onInput
.
This idea that Elm’s state includes buffer variables to keep track of these things is considerably different from other tools like React or Vue where there are component-level variables that typically store that data. I’ll have to get used to this.