Question: Do lists have custom syntax?

Asked By
joelq
Asked At
2017-12-15 01:55:42

Found 15 possible answers.

User Answered At Possible Answer
jessta 2017-12-15 01:55:50 [1,2,3,4]
joelq 2017-12-15 01:56:42 ah, forgot about the literal syntax :+1:
jessta 2017-12-15 01:56:51 and the only custom syntax for bools is if without if , bool is just a user definable union type
joelq 2017-12-15 01:57:34 A lot of this hardcoded syntax is really just sugar though without custom language syntax You could write 1 :: 2 :: 3 :: 4 :: [] and ifThen : Bool -> a -> a -> a
jessta 2017-12-15 01:58:48 if is a pain to user define because it's lazy
joelq 2017-12-15 01:59:04 ah, yes
zcnave 2017-12-15 01:59:30 @jessta @joelq so on a very high (abstract?) level Elm is basically variables and functions (user defined or syntax provided by language), an i thinking correct?
jessta 2017-12-15 01:59:46 you'd need ifThen : Bool -> (() -> a) -> (()-> a) -> (()-> a) @zcnave Elm has values, some of those value are functions
joelq 2017-12-15 02:01:36 Does Elm distinguish between a value and a 0-arg function? while Nothing can be thought of as a value or a 0-arg function Just is a 1-arg function e.g. type Maybe a = Just a | Nothing
jessta 2017-12-15 02:02:19 Just is just a value of type (a-> Maybe a)
joelq 2017-12-15 02:03:28 I guess I'm asking if all values are functions or are all functions values :scream_cat: Not that it really matters for day-to-day coding
jessta 2017-12-15 02:03:47 all functions are values is clearly true 'all values are functions' is a lot weirder because 0-arg functions aren't exactly functions since their type is definitely not the type of a function
joelq 2017-12-15 02:06:16 I guess that makes sense if you say all functions have exactly 1-arg (and allow currying to fake multiple args)
jessta 2017-12-15 02:06:37 all functions have -> in their type someFunc a = a+1 is just sugar for someFunc = \a -> a +1
jma 2017-12-15 05:33:26 The architecture tutorial, in the Effects - Random section, has some exercises at the end. The second bullet is to "Add a second die and have them both roll at the same time." I believe one is supposed to use Random.pair to solve this. However, after many, many unsuccessful tries the Elm compiler still tells me there's something wrong and my brain doesn't seem to comprehend how the various pieces fit together (or what the pieces really are).

Related Questions